<template>
    <div class="warp">
        <el-row class="content">
            <div class="form-query-box">
                <el-col :span="20" class="form-query">
                    <el-form ref="form" :model="formQuery" size="mini">
                        <el-col :span="6">
                            <el-form-item label="大类：" label-width="80px">
                                <el-input v-model="formQuery.category"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="小类：" label-width="80px">
                                <el-input v-model="formQuery.subCategory"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="姓名：" label-width="80px">
                                <el-input size="mini" v-model="formQuery.userName"></el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="6">
                            <el-form-item label="职称：" label-width="100px">
                                <el-input size="mini" v-model="formQuery.jobTitle"></el-input>
                            </el-form-item>
                        </el-col>
                    </el-form>
                </el-col>
                <el-col :span="2" :offset="1" class="query-bar">
                    <el-button type="primary" size="small" @click="getFindApplyRecordList(1)" round>查询</el-button>
                </el-col>
            </div>
            <div class="content-table">
                <el-table
                        :data="tableData"
                        border
                        size="mini"
                        style="width: 100%"
                        header-row-class-name="table-header">
                    <el-table-column
                            prop="categoryId"
                            label="大类"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="categoryChildId"
                            label="小类"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="categoryAcademicId"
                            label="职称"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="userName"
                            label="姓名"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            prop="technologyTitle"
                            label="现任职务"
                            align="center">
                    </el-table-column>
                    <el-table-column
                            label="操作"
                            align="center">
                        <template slot-scope="scope">
                            <el-button @click="handleClick(scope.row)" type="text" size="small">查看详情</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </div>
            <div class="pagination">
                <el-pagination
                        background
                        layout="total,prev, pager, next"
                        @current-change="handleCurrentPage"
                        :total="total">
                </el-pagination>
            </div>
        </el-row>
    </div>
</template>

<script>
    import { findApplyRecordList } from '@/service/api'
    import Qs from 'qs'
    export default {
        name: "staffTitles",
        data() {
            return {
                formQuery: {
                    category: '', //大类
                    subCategory: '', //小类
                    userName: '', //姓名
                    jobTitle: '' //职称
                },
                total:0,
                pageNum:1,
                tableData: []
            }
        },
        created() {
            console.log(this.$route.params)
            this.formQuery.category = this.$route.params.category;
            this.formQuery.subCategory = this.$route.params.subCategory;
            this.getFindApplyRecordList(this.pageNum);
        },
        methods:{
            getFindApplyRecordList(pageNum){
                let params = {
                    category: this.formQuery.category,
                    subCategory: this.formQuery.subCategory,
                    userName: this.formQuery.userName,
                    jobTitle: this.formQuery.jobTitle,
                    pageNum:pageNum,pageSize:10,
                    queryType:'3'
                };
                findApplyRecordList(Qs.stringify(params)).then(res => {
                    if(res.code == 200){
                        console.log(res)
                        this.tableData = res.data.list;
                        this.total = res.data.count;
                    }else {
                        console.log(res)
                    }
                });
            },
            handleCurrentPage(e) {
                this.getFindApplyRecordList(e)
            },
            handleClick(e){
                console.log(e)
                this.$router.push({name:"reviewsInfo",params:{id:e.id}});
            }
        }
    }
</script>

<style scoped>
    .warp {
        /*width: 100%;*/
        /*height: 100%;*/
        /*overflow-y: scroll;*/
        height: 100%;
        /*background: #F4F1F4;*/
    }

    .form-query-box {
        height: 50px;
        margin-bottom: 18px;
        /*overflow: hidden;*/
    }
    .form-query {
        margin-top: 20px;
    }

    .query-bar {
        margin-top: 20px;
    }

    .query-bar >>> .el-button {
        width: 80px;
    }

    .content {
        width: 100%;
        min-height: 520px;
        height: 100%;
        background: rgba(255, 255, 255, 1);
        box-shadow: 0px 9px 8px 2px rgba(43, 103, 254, 0.05);
        border-radius: 5px;
        overflow: hidden;
    }
    .content-table {
        min-height: 410px;
        margin: 13px 25px;
        border-radius: 5px 5px 0px 0px;
        overflow: hidden;
    }

    .content-table >>> .table-header th {
        background: #E6EAEB !important;
        border: none;
    }
    .content-table >>> .table-header th div{
        font-weight:bold !important;
        color: #333;
    }

    .content-table >>> tbody tr:nth-child(even) td {
        background: #F5F8FE;
    }

    .content-table >>> tbody .el-button {
        padding: 5px 15px;
    }
    .pagination{
        margin-top: 10px;
        text-align: end;
        padding-right: 16px;
    }
</style>
